import {reactive,onMounted} from "vue";
import axios from "axios";
export default function (){
    let dogList = reactive(['https://img0.baidu.com/it/u=3108954904,3938895794&fm=253&fmt=auto&app=120&f=JPEG?w=1280&h=800']);

    async function getDog(){
        try{
            let result = await axios.get('https://dog.ceo/breed/pembroke/images/random')
            dogList.push(result.data.message)
        }catch (e){
            console.log(e)
        }
    }

    ///钩子
    onMounted(()=>getDog())

    return {dogList,getDog}
}
